/*******************************************************************************
* Project: QSAR(Cute Software Architecture) 
*
* Copyright: Copyright(C) 2024 by YuetingBen, All Rights Reserved
*
* File name: Xcp.c
*
* Brief: ;
*
* Author: Yueting.Ben
*
* Module: Xcp
*
*******************************************************************************/

/** HEADER FILES **/
#include "Xcp.h"


/** MACRO DEFINITION **/

/* Standard commands */
#define XCP_CMD_CONNECT               (0xFFu)
#define XCP_CMD_DISCONNECT            (0xFEu)
#define XCP_CMD_GET_STATUS            (0xFDu)
#define XCP_CMD_SYNC                   (0xFCu)

#define XCP_CMD_GET_COMM_MODE_INFO     (0xFBu)
#define XCP_CMD_GET_ID                  (0xFAu)
#define XCP_CMD_SET_REQUEST             (0xF9u)
#define XCP_CMD_GET_SEED                (0xF8u)
#define XCP_CMD_UNLOCK                  (0xF7u)
#define XCP_CMD_SET_MTA                 (0xF6u)
#define XCP_CMD_UPLOAD                  (0xF5u)
#define XCP_CMD_SHORT_UPLOAD            (0xF4u)
#define XCP_CMD_BUILD_CHECKSUM          (0xF3u)

#define XCP_CMD_TRANSPORT_LAYER_CMD     (0xF2u)
#define XCP_CMD_USER_CMD                 (0xF1u)

/* STIM frames */
#define XCP_CMD_START_INDEX_CMD         (0xC0u)


#define XCP_PID_INDEX                    (0u)



/** TYPEDEF DEFINITION **/
typedef enum
{
   XCP_CMD_INDEX_CONNECT = 0x00,
   XCP_CMD_INDEX_DISCONNECT,
   XCP_CMD_INDEX_MAX
}XCP_CMD_INDEX;


typedef struct
{
    PduInfoType PduInfo;
}XcpTxInfoType;

typedef uint16 Xcp_CommandStatusType;
#define XCP_CMDSTATUS_IDLE             0x00u
#define XCP_CMDSTATUS_TRANSF           0x01u

typedef struct
{
    PduInfoType ReqPduInfo;
    PduInfoType ResPduInfo;
    uint8 MtaExtension;
    uint32 Mta;
    uint8 ResponseDataIndex;
    uint8 ConnectState;
    Xcp_CommandStatusType CommandStatus;
}XcpInfoType;


typedef void (*XcpCmdFuncType)(
    uint8 Channel,
    uint8* CmdPtr
);


/** LOCAL DATA DECLARATION **/


/** GLOBAL DATA DECLARATION **/
XcpTxInfoType XcpTxInfo;



static XcpInfoType XcpInfo[XcpConf_Channel_Max];

/** LOCAL FUNCTION DECLARATION **/
static void XcpCmdReservedCmd(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdStdConnect(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdStdDisconnect(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdStdGetStatus(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdStdSynch(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdStdGetCommModeInfo(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdStdGetId(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdStdSetRequest(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdStdGetSeed(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdStdUnlock(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdStdSetMta(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdStdUpload(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdStdShortUpload(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdStdTlCmd(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdStdBuildChecksum(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdStdUserCmd(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdCalDownload(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdCalDownloadNext(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdCalDownloadMax(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdCalShortDownload(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdCalModifyBits(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdPagSetCalPage(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdPagGetCalPage(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdPagGetPageProcessorInfo(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdPagSetSegmentMode(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdPagGetSegmentMode(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdPagCopyCalPage(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdDaqSetDaqPtr(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdDaqWriteDaq(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdDaqSetDaqListMode(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdDaqGetDaqListMode(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdDaqStartStopDaqList(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdDaqStartStopSynch(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdDaqGetDaqClock(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdDaqGetDaqProcessorInfo(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdDaqGetDaqResolutionInfo(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdDaqGetDaqEventInfo(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdDaqFreeDaq(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdDaqAllocDaq(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdDaqAllocOdt(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdDaqAllocOdtEntry(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdPgmProgramStart(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdPgmProgramClear(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdPgmProgram(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdPgmProgramReset(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdPgmGetPgmProcessorInfo(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdPgmGetSectorInfo(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdPgmProgramPrepare(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdPgmProgramNext(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdPgmProgramMax(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpCmdDaqWriteDaqMultiple(
    uint8 Channel,
    uint8* CmdPtr
);

static void XcpSendResponse(
    uint8 Channel
);

/** GLOBAL FUNCTION DECLARATION **/
void Xcp_GetVersionInfo(
    Std_VersionInfoType* versionInfo
);


/** LOCAL DATA **/
XcpCmdFuncType XcpCmdFunc[64u] = 
{
    XcpCmdStdConnect,                     /* 0xFF = CONNECT */
    XcpCmdStdDisconnect,                  /* 0xFE = DISCONNECT */
    XcpCmdStdGetStatus,                   /* 0xFD = GETSTATUS */
    XcpCmdStdSynch,                       /* 0xFC = SYNCH */
    XcpCmdStdGetCommModeInfo,             /* 0xFB = GETCOMMMODEINFO */
    XcpCmdStdGetId,                       /* 0xFA = GETID */
    XcpCmdStdSetRequest,                  /* 0xF9 = SETREQUEST */
    XcpCmdStdGetSeed,                     /* 0xF8 = GETSEED */
    XcpCmdStdUnlock,                      /* 0xF7 = UNLOCK */
    XcpCmdStdSetMta,                      /* 0xF6 = SETMTA */
    XcpCmdStdUpload,                      /* 0xF5 = UPLOAD */
    XcpCmdStdShortUpload,                 /* 0xF4 = SHORTUPLOAD */
    XcpCmdStdTlCmd,                       /* 0xF2 = TRANSPORT_LAYER_CMD */
    XcpCmdStdBuildChecksum,               /* 0xF3 = BUILDCHECKSUM */
    XcpCmdStdUserCmd,                     /* 0xF1 = USERCMD */
    XcpCmdCalDownload,                    /* 0xF0 = DOWNLOAD */
    XcpCmdCalDownloadNext,                /* 0xEF = DOWNLOADNEXT */
    XcpCmdCalDownloadMax,                 /* 0xEE = DOWNLOADMAX */
    XcpCmdCalShortDownload,               /* 0xED = SHORTDOWNLOAD */
    XcpCmdCalModifyBits,                  /* 0xEC = MODIFYBITS */
    XcpCmdPagSetCalPage,                  /* 0xEB = SETCALPAGE */
    XcpCmdPagGetCalPage,                  /* 0xEA = GETCALPAGE */
    XcpCmdPagGetPageProcessorInfo,        /* 0xE9 = GETPAGPROCESSORINFO */
    XcpCmdReservedCmd,                    /* 0xE8 = GETSEGMENTINFO */
    XcpCmdReservedCmd,                    /* 0xE7 = GETPAGEINFO */
    XcpCmdPagSetSegmentMode,              /* 0xE6 = SETSEGMENTMODE */
    XcpCmdPagGetSegmentMode,              /* 0xE5 = GETSEGMENTMODE */
    XcpCmdPagCopyCalPage,                 /* 0xE4 = COPYCALPAGE */
    XcpCmdReservedCmd,                    /* 0xE3 = CLEARDAQLIST */
    XcpCmdDaqSetDaqPtr,                   /* 0xE2 = SETDAQPTR */
    XcpCmdDaqWriteDaq,                    /* 0xE1 = WRITEDAQ */
    XcpCmdDaqSetDaqListMode,              /* 0xE0 = SETDAQLISTMODE */
    XcpCmdDaqGetDaqListMode,              /* 0xDF = GETDAQLISTMODE */
    XcpCmdDaqStartStopDaqList,            /* 0xDE = STARTSTOPDAQLIST */
    XcpCmdDaqStartStopSynch,              /* 0xDD = STARTSTOPSYNCH */
    XcpCmdDaqGetDaqClock,                 /* 0xDC = GETDAQCLOCK */
    XcpCmdReservedCmd,                    /* 0xDB = READDAQ */
    XcpCmdDaqGetDaqProcessorInfo,         /* 0xDA = GETDAQPROCESSORINFO */
    XcpCmdDaqGetDaqResolutionInfo,        /* 0xD9 = GETDAQRESOLUTIONINFO */
    XcpCmdReservedCmd,                    /* 0xD8 = GETDAQLISTINFO */
    XcpCmdDaqGetDaqEventInfo,             /* 0xD7 = GETDAQEVENTINFO */
    XcpCmdDaqFreeDaq,                     /* 0xD6 = FREEDAQ */
    XcpCmdDaqAllocDaq,                    /* 0xD5 = ALLOCDAQ */
    XcpCmdDaqAllocOdt,                    /* 0xD4 = ALLOCODT */
    XcpCmdDaqAllocOdtEntry,               /* 0xD3 = ALLOCODTENTRY */
    XcpCmdPgmProgramStart,                /* 0xD2 = PROGRAMSTART */
    XcpCmdPgmProgramClear,                /* 0xD1 = PROGRAMCLEAR */
    XcpCmdPgmProgram,                     /* 0xD0 = PROGRAM */
    XcpCmdPgmProgramReset,                /* 0xCF = PROGRAMRESET */
    XcpCmdPgmGetPgmProcessorInfo,         /* 0xCE = GETPGMPROCESSORINFO */
    XcpCmdPgmGetSectorInfo,               /* 0xCD = GETSECTORINFO */
    XcpCmdPgmProgramPrepare,              /* 0xCC = PROGRAMPREPARE */
    XcpCmdReservedCmd,                    /* 0xCB = PROGRAMFORMAT */
    XcpCmdPgmProgramNext,                 /* 0xCA = PROGRAMNEXT */
    XcpCmdPgmProgramMax,                  /* 0xC9 = PROGRAMMAX */
    XcpCmdReservedCmd,                    /* 0xC8 = PROGRAMVERIFY */
    XcpCmdDaqWriteDaqMultiple,            /* 0xC7 = WRITEDAQMULTIPLE */
    XcpCmdReservedCmd,                    /* 0xC6 = RESERVED */
    XcpCmdReservedCmd,                    /* 0xC5 = RESERVED */
    XcpCmdReservedCmd,                    /* 0xC4 = RESERVED */
    XcpCmdReservedCmd,                    /* 0xC3 = RESERVED */
    XcpCmdReservedCmd,                    /* 0xC2 = RESERVED */
    XcpCmdReservedCmd,                    /* 0xC1 = RESERVED */
    XcpCmdReservedCmd,                    /* 0xC0 = RESERVED */
};

/** GLOBAL DATA **/


/** LOCAL FUNCTION **/


/*******************************************************************************
* -Name         XcpCmdReservedCmd
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdReservedCmd(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdStdConnect
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdStdConnect(
    uint8 Channel,
    uint8* CmdPtr
)
{
    XcpInfoType* xcpInfoPtr = (XcpInfoType*)&XcpInfo[Channel];

    xcpInfoPtr->ResPduInfo.SduDataPtr[0] = 0xFF;
    xcpInfoPtr->ResPduInfo.SduDataPtr[1] = 0x15;
    xcpInfoPtr->ResPduInfo.SduDataPtr[2] = 0xC0;
    xcpInfoPtr->ResPduInfo.SduDataPtr[3] = 0x08; /* MAX_CTO, Maximum CTO size [BYTE] */
    xcpInfoPtr->ResPduInfo.SduDataPtr[4] = 0x08; /* MAX_DTO, Maximum DTO size [BYTE]  */
    xcpInfoPtr->ResPduInfo.SduDataPtr[5] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[6] = 0x01; /* XCP Protocol Layer Version Number  */
    xcpInfoPtr->ResPduInfo.SduDataPtr[7] = 0x01; /* XCP Transport Layer Version Number  */
    xcpInfoPtr->ResPduInfo.SduLength = 8u;
}

/*******************************************************************************
* -Name         XcpCmdStdDisconnect
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdStdDisconnect(
    uint8 Channel,
    uint8* CmdPtr
)
{
    XcpInfoType* xcpInfoPtr = (XcpInfoType*)&XcpInfo[Channel];
    
    xcpInfoPtr->ResPduInfo.SduDataPtr[0] = 0xFF;
    xcpInfoPtr->ResPduInfo.SduDataPtr[1] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[2] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[3] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[4] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[5] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[6] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[7] = 0x00;
    xcpInfoPtr->ResPduInfo.SduLength = 8u;
}

/*******************************************************************************
* -Name         XcpCmdStdGetStatus
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdStdGetStatus(
    uint8 Channel,
    uint8* CmdPtr
)
{
    XcpInfoType* xcpInfoPtr = (XcpInfoType*)&XcpInfo[Channel];
    
    xcpInfoPtr->ResPduInfo.SduDataPtr[0] = 0xFF;
    xcpInfoPtr->ResPduInfo.SduDataPtr[1] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[2] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[3] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[4] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[5] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[6] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[7] = 0x00;
    xcpInfoPtr->ResPduInfo.SduLength = 8u;
}

/*******************************************************************************
* -Name         XcpCmdStdSynch
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdStdSynch(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdStdGetCommModeInfo
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdStdGetCommModeInfo(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdStdGetId
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdStdGetId(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdStdSetRequest
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdStdSetRequest(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdStdGetSeed
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdStdGetSeed(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdStdUnlock
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdStdUnlock(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdStdSetMta
* -Brief        Command 0xF6
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdStdSetMta(
    uint8 Channel,
    uint8* CmdPtr
)
{
    XcpInfoType* xcpInfoPtr = (XcpInfoType*)&XcpInfo[Channel];
    uint8 dataLen;
    uint32 address;
    
    dataLen = xcpInfoPtr->ReqPduInfo.SduDataPtr[1];
    address = (uint32)((xcpInfoPtr->ReqPduInfo.SduDataPtr[7] << 24)
                     |(xcpInfoPtr->ReqPduInfo.SduDataPtr[6] << 16)
                     |(xcpInfoPtr->ReqPduInfo.SduDataPtr[5] << 8)
                     |(xcpInfoPtr->ReqPduInfo.SduDataPtr[4]));

    xcpInfoPtr->Mta = address;
    xcpInfoPtr->ResponseDataIndex = 0u;

    xcpInfoPtr->ResPduInfo.SduDataPtr[0] = 0xFF;
    xcpInfoPtr->ResPduInfo.SduDataPtr[1] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[2] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[3] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[4] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[5] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[6] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[7] = 0x00;
    
    xcpInfoPtr->ResPduInfo.SduLength = 8u;
}

/*******************************************************************************
* -Name         XcpCmdStdUpload
* -Brief        Command 0xF5
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdStdUpload(
    uint8 Channel,
    uint8* CmdPtr
)
{
    XcpInfoType* xcpInfoPtr = (XcpInfoType*)&XcpInfo[Channel];
    uint8 dataLen;
    
    dataLen = xcpInfoPtr->ReqPduInfo.SduDataPtr[1];
    memcpy((uint8 *)(&xcpInfoPtr->ResPduInfo.SduDataPtr[1u]), (uint8 *)(xcpInfoPtr->Mta + xcpInfoPtr->ResponseDataIndex), dataLen);
    xcpInfoPtr->ResponseDataIndex = xcpInfoPtr->ResponseDataIndex + dataLen;  
}

/*******************************************************************************
* -Name         XcpCmdStdShortUpload
* -Brief        Command 0xF4
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdStdShortUpload(
    uint8 Channel,
    uint8* CmdPtr
)
{
    uint8 dataLen;
    uint32 address;
    XcpInfoType* xcpInfoPtr = (XcpInfoType*)&XcpInfo[Channel];
    
    dataLen = xcpInfoPtr->ReqPduInfo.SduDataPtr[1];
    address = (uint32)((xcpInfoPtr->ReqPduInfo.SduDataPtr[7] << 24)
                     |(xcpInfoPtr->ReqPduInfo.SduDataPtr[6] << 16)
                     |(xcpInfoPtr->ReqPduInfo.SduDataPtr[5] << 8)
                     |(xcpInfoPtr->ReqPduInfo.SduDataPtr[4]));

    xcpInfoPtr->ResPduInfo.SduDataPtr[0] = 0xFF;
    xcpInfoPtr->ResPduInfo.SduDataPtr[1] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[2] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[3] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[4] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[5] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[6] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[7] = 0x00;
    memcpy((uint8 *)(&xcpInfoPtr->ResPduInfo.SduDataPtr[1u]), (uint8 *)(address), dataLen);
    
    xcpInfoPtr->ResPduInfo.SduLength = 8u;
}

/*******************************************************************************
* -Name         XcpCmdStdTlCmd
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdStdTlCmd(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdStdBuildChecksum
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdStdBuildChecksum(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdStdUserCmd
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdStdUserCmd(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdCalDownload
* -Brief        Command 0xF0
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdCalDownload(
    uint8 Channel,
    uint8* CmdPtr
)
{
    uint8 dataLen;
    XcpInfoType* xcpInfoPtr = (XcpInfoType*)&XcpInfo[Channel];
    
    dataLen = xcpInfoPtr->ReqPduInfo.SduDataPtr[1];

    xcpInfoPtr->ResPduInfo.SduDataPtr[0] = 0xFF;
    xcpInfoPtr->ResPduInfo.SduDataPtr[1] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[2] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[3] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[4] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[5] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[6] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[7] = 0x00;
    memcpy((uint8 *)(xcpInfoPtr->Mta + xcpInfoPtr->ResponseDataIndex), &xcpInfoPtr->ReqPduInfo.SduDataPtr[2u] , dataLen);
    xcpInfoPtr->ResponseDataIndex = xcpInfoPtr->ResponseDataIndex + dataLen; 
    
    xcpInfoPtr->ResPduInfo.SduLength = 8u;
}

/*******************************************************************************
* -Name         XcpCmdCalDownloadNext
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdCalDownloadNext(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdCalDownloadMax
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdCalDownloadMax(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdCalShortDownload
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdCalShortDownload(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdCalModifyBits
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdCalModifyBits(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdPagSetCalPage
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdPagSetCalPage(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdPagGetCalPage
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdPagGetCalPage(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdPagGetPageProcessorInfo
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdPagGetPageProcessorInfo(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdPagSetSegmentMode
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdPagSetSegmentMode(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdPagGetSegmentMode
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdPagGetSegmentMode(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdPagCopyCalPage
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdPagCopyCalPage(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdDaqSetDaqPtr
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdDaqSetDaqPtr(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdDaqWriteDaq
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdDaqWriteDaq(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdDaqSetDaqListMode
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdDaqSetDaqListMode(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdDaqGetDaqListMode
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdDaqGetDaqListMode(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdDaqStartStopDaqList
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdDaqStartStopDaqList(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdDaqStartStopSynch
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdDaqStartStopSynch(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdDaqGetDaqClock
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdDaqGetDaqClock(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdDaqGetDaqProcessorInfo
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdDaqGetDaqProcessorInfo(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdDaqGetDaqResolutionInfo
* -Brief        Command 0xD9
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdDaqGetDaqResolutionInfo(
    uint8 Channel,
    uint8* CmdPtr
)
{
    XcpInfoType* xcpInfoPtr = (XcpInfoType*)&XcpInfo[Channel];
    
    xcpInfoPtr->ResPduInfo.SduDataPtr[0] = 0xFF;
    xcpInfoPtr->ResPduInfo.SduDataPtr[1] = 0x01;
    xcpInfoPtr->ResPduInfo.SduDataPtr[2] = 0x01;
    xcpInfoPtr->ResPduInfo.SduDataPtr[3] = 0x01;
    xcpInfoPtr->ResPduInfo.SduDataPtr[4] = 0x01;
    xcpInfoPtr->ResPduInfo.SduDataPtr[5] = 0x01;
    xcpInfoPtr->ResPduInfo.SduDataPtr[6] = 0x01;
    xcpInfoPtr->ResPduInfo.SduDataPtr[7] = 0x01;
    xcpInfoPtr->ResPduInfo.SduLength = 8u;
}

/*******************************************************************************
* -Name         XcpCmdDaqGetDaqEventInfo
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdDaqGetDaqEventInfo(
    uint8 Channel,
    uint8* CmdPtr
)
{
    XcpInfoType* xcpInfoPtr = (XcpInfoType*)&XcpInfo[Channel];
    
    xcpInfoPtr->ResPduInfo.SduDataPtr[0] = 0xFF;
    xcpInfoPtr->ResPduInfo.SduDataPtr[1] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[2] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[3] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[4] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[5] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[6] = 0x00;
    xcpInfoPtr->ResPduInfo.SduDataPtr[7] = 0x00;
    xcpInfoPtr->ResPduInfo.SduLength = 8u;
}

/*******************************************************************************
* -Name         XcpCmdDaqFreeDaq
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdDaqFreeDaq(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdDaqAllocDaq
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdDaqAllocDaq(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdDaqAllocOdt
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdDaqAllocOdt(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdDaqAllocOdtEntry
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdDaqAllocOdtEntry(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdPgmProgramStart
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdPgmProgramStart(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdPgmProgramClear
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdPgmProgramClear(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdPgmProgram
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdPgmProgram(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdPgmProgramReset
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdPgmProgramReset(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdPgmGetPgmProcessorInfo
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdPgmGetPgmProcessorInfo(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdPgmGetSectorInfo
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdPgmGetSectorInfo(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdPgmProgramPrepare
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdPgmProgramPrepare(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdPgmProgramNext
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdPgmProgramNext(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdPgmProgramMax
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdPgmProgramMax(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdDaqWriteDaqMultiple
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpCmdDaqWriteDaqMultiple(
    uint8 Channel,
    uint8* CmdPtr
)
{
    
}

/*******************************************************************************
* -Name         XcpCmdDaqWriteDaqMultiple
* -Brief        Command
* -Details      None
* -Param[in]    Channel: The channel which should be connected
* -Param[in]    CmdPtr: Containing the received XCP message for Connect Command 
* -Return       None          
*******************************************************************************/
static void XcpSendResponse(
    uint8 Channel
)
{
    Std_ReturnType retval = E_NOT_OK;
    XcpInfoType* xcpInfoPtr = (XcpInfoType*)&XcpInfo[Channel];
    XcpPduType* xcpPduCfgPtr = (XcpPduType*)&XcpPdu[Channel];
    
    retval = CanIf_Transmit(xcpPduCfgPtr->XcpTxPdu.XcpTxPduId, (PduInfoType*)&xcpInfoPtr->ResPduInfo);
    if(E_OK == retval)
    {
        xcpInfoPtr->CommandStatus = XCP_CMDSTATUS_IDLE;
    }
}



/** GLOBAL FUNCTION **/

/*******************************************************************************
* -Name         Xcp_SetTransmissionMode
* -Brief        This API is used to turn on and off of the TX capabilities of used communication bus channel in XCP module.
* -Details      None
* -Param[in]    Channel: The Network channel for the used bus communication
* -Param[in]    Mode: Enabled or disabled Transmission mode Parameters 
* -Return       None          
*******************************************************************************/
void Xcp_SetTransmissionMode( 
    NetworkHandleType Channel, 
    Xcp_TransmissionModeType Mode 
) 
{
    
}

/*******************************************************************************
* -Name         Xcp_RxIndication
* -Brief        Indication of a received PDU from a lower layer communication interface module.
* -Details      None
* -Param[in]    RxPduId: ID of the received PDU
* -Param[in]    PduInfoPtr: Contains the length (SduLength) of the received PDU, a pointer to a buffer (SduDataPtr) 
*                           containing the PDU, and the MetaData related to this PDU
* -Return       None          
*******************************************************************************/
void Xcp_RxIndication( 
  PduIdType RxPduId, 
  const PduInfoType* PduInfoPtr 
) 
{
    uint8 Channel = XcpConf_Channel_00;
    XcpInfoType* xcpInfoPtr = (XcpInfoType*)&XcpInfo[Channel];
    
    memcpy((uint8 *)(&xcpInfoPtr->ReqPduInfo.SduDataPtr[0u]), (uint8 *)(PduInfoPtr->SduDataPtr), PduInfoPtr->SduLength);
    if(XCP_CMD_START_INDEX_CMD <= PduInfoPtr->SduDataPtr[XCP_PID_INDEX])
    {
        XcpCmdFunc[(0xFF - xcpInfoPtr->ReqPduInfo.SduDataPtr[XCP_PID_INDEX])](XcpConf_Channel_00, xcpInfoPtr->ReqPduInfo.SduDataPtr);
    }

    xcpInfoPtr->CommandStatus = XCP_CMDSTATUS_TRANSF;
}

/*******************************************************************************
* -Name         Xcp_TriggerTransmit
* -Brief        The lower layer communication interface module confirms the transmission of a PDU, or the failure to transmit a PDU
* -Details      None
* -Param[in]    TxPduId: ID of the SDU that is requested to be transmitted
* -Param[in]    PduInfoPtr: Contains a pointer to a buffer (SduDataPtr) to where the SDU data shall 
*                           be copied, and the available buffer size in SduLengh. On return, the 
*                           service will indicate the length of the copied SDU data in SduLength
* -Return       E_OK: SDU has been copied and SduLength indicates the number of copied bytes. 
*               E_NOT_OK: No SDU data has been copied. PduInfoPtr must not be used since it may contain 
*                         a NULL pointer or point to invalid data.          
*******************************************************************************/
Std_ReturnType Xcp_TriggerTransmit( 
  PduIdType TxPduId, 
  PduInfoType* PduInfoPtr 
) 
{
    
}


/*******************************************************************************
* -Name         Xcp_TxConfirmation
* -Brief        The lower layer communication interface module confirms the transmission of a PDU, or the failure to transmit a PDU
* -Details      None
* -Param[in]    TxPduId: ID of the PDU that has been transmitted
* -Param[in]    result: E_OK: The PDU was transmitted. E_NOT_OK: Transmission of the PDU failed
* -Return       None          
*******************************************************************************/
void Xcp_TxConfirmation( 
  PduIdType TxPduId, 
  Std_ReturnType result 
)
{

}

/*******************************************************************************
* -Name         Xcp_GetVersionInfo
* -Brief        Returns the version information of this module 
* -Details      None
* -Param[out]   versioninfo: Pointer to the version information of this module
* -Return       None          
*******************************************************************************/
void Xcp_GetVersionInfo(
    Std_VersionInfoType* versionInfo
)
{
    versionInfo->vendorID = (uint16)YSAR_VENDOR_ID;
    versionInfo->moduleID = (uint8)XCP_MODULE_ID;
    versionInfo->sw_major_version = (uint8)XCP_SW_MAJOR_VERSION;
    versionInfo->sw_minor_version = (uint8)XCP_SW_MINOR_VERSION;
    versionInfo->sw_patch_version = (uint8)XCP_SW_PATCH_VERSION;
}


/*******************************************************************************
* -Name         Xcp_Init
* -Brief        This service initializes interfaces and variables of the AUTOSAR XCP layer 
* -Details      None
* -Param[in]    Xcp_ConfigPtr: Pointer to a selected configuration structure
* -Return       None          
*******************************************************************************/
void Xcp_Init(
    const Xcp_ConfigType* Xcp_ConfigPtr 
)
{
    uint8 Channel = XcpConf_Channel_00;
    XcpInfoType* xcpInfoPtr = (XcpInfoType*)&XcpInfo[Channel];

    xcpInfoPtr->ReqPduInfo.SduDataPtr = (uint8*)XcpPdu[Channel].XcpRxPdu.XcpRxPduRef->MetaDataTypeRef->MetaDataItem;
    xcpInfoPtr->ResPduInfo.SduDataPtr = (uint8*)XcpPdu[Channel].XcpTxPdu.XcpTxPduRef->MetaDataTypeRef->MetaDataItem;
}

/*******************************************************************************
* -Name         Xcp_MainFunction
* -Brief        Scheduled function of the XCP module 
* -Details      None
* -Param[in]    None
* -Return       None          
*******************************************************************************/
void Xcp_MainFunction( 
    void 
)
{
    uint8 Channel = XcpConf_Channel_00;
    XcpInfoType* xcpInfoPtr = (XcpInfoType*)&XcpInfo[Channel];
    
    if(XCP_CMDSTATUS_TRANSF == xcpInfoPtr->CommandStatus)
    {
        XcpSendResponse(Channel);
    }
}

